//
//  BYGameBoxManager.m
//  Embedded-WebServer
//
//  Created by Ampaw on 2019/2/26.
//  Copyright © 2019年 Ampaw. All rights reserved.
//

#import "BYGameBoxManager.h"
#import "AppDelegate.h"
#import "BYGameBoxViewController.h"
#import "BYMasonry.h"
#import "BYGameBoxView.h"

@implementation BYGameBoxManager

+ (BYGameBoxManager *)manager {
    static id manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[BYGameBoxManager alloc] init];
    });
    return manager;
}

- (void)addViewControllerToKeyWindow {
    AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    BYGameBoxViewController *gameBoxVC = [[BYGameBoxViewController alloc] initWithOrientation:UIInterfaceOrientationMaskPortrait];
    delegate.window.rootViewController = gameBoxVC;
    [delegate.window makeKeyAndVisible];
}

- (void)addViewToKeyWindow {
    BYGameBoxView *gameView = [[BYGameBoxView alloc] initWithOrientation:UIInterfaceOrientationMaskPortrait];
    [[UIApplication sharedApplication].keyWindow addSubview:gameView];
    [gameView mas_makeConstraints:^(BYMASConstraintMaker *make) {
        make.edges.mas_offset(0);
    }];
}

@end
